<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
  <meta name="theme-color" content="#222">
  <meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

  <link rel="stylesheet" href="/css/main.css">



  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.2/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

  <script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {
      "hostname": "holidaypenguin.gitee.io",
      "root": "/",
      "images": "/images",
      "scheme": "Mist",
      "version": "8.2.2",
      "exturl": false,
      "sidebar": {
        "position": "right",
        "display": "always",
        "padding": 18,
        "offset": 12
      },
      "copycode": true,
      "bookmark": {
        "enable": false,
        "color": "#222",
        "save": "auto"
      },
      "fancybox": false,
      "mediumzoom": false,
      "lazyload": false,
      "pangu": false,
      "comments": {
        "style": "tabs",
        "active": null,
        "storage": true,
        "lazyload": false,
        "nav": null
      },
      "motion": {
        "enable": true,
        "async": true,
        "transition": {
          "post_block": "fadeIn",
          "post_header": "fadeInDown",
          "post_body": "fadeInDown",
          "coll_header": "fadeInLeft",
          "sidebar": "slideUpIn"
        }
      },
      "prism": false,
      "i18n": {
        "placeholder": "搜索...",
        "empty": "没有找到任何搜索结果：${query}",
        "hits_time": "找到 ${hits} 个搜索结果（用时 ${time} 毫秒）",
        "hits": "找到 ${hits} 个搜索结果"
      },
      "path": "/search.xml",
      "localsearch": {
        "enable": true,
        "trigger": "auto",
        "top_n_per_article": 1,
        "unescape": false,
        "preload": false
      }
    };
  </script>
  <meta property="og:type" content="article">
  <meta property="og:title" content="host 在实际项目中的使用">
  <meta property="og:url" content="https://holidaypenguin.gitee.io/blob/2018-12-17-the-use-of-host-in-practical-projects/index.html">
  <meta property="og:site_name" content="HolidayPenguin">
  <meta property="og:locale" content="zh_CN">
  <meta property="article:published_time" content="2018-12-17T07:01:27.000Z">
  <meta property="article:modified_time" content="2018-12-17T07:01:27.000Z">
  <meta property="article:author" content="holidaypenguin">
  <meta property="article:tag" content="Host">
  <meta property="article:tag" content="Hosts">
  <meta property="article:tag" content="代理">
  <meta property="article:tag" content="转发">
  <meta property="article:tag" content="SwitchHosts">
  <meta property="article:tag" content="移动端">
  <meta name="twitter:card" content="summary">


  <link rel="canonical" href="https://holidaypenguin.gitee.io/blob/2018-12-17-the-use-of-host-in-practical-projects/">


  <script class="page-configurations">
    // https://hexo.io/docs/variables.html
    CONFIG.page = {
      sidebar: "",
      isHome: false,
      isPost: true,
      lang: 'zh-CN'
    };
  </script>
  <title>host 在实际项目中的使用 | HolidayPenguin</title>





  <noscript>
    <style>
      body {
        margin-top: 2rem;
      }

      .use-motion .menu-item,
      .use-motion .sidebar,
      .use-motion .post-block,
      .use-motion .pagination,
      .use-motion .comments,
      .use-motion .post-header,
      .use-motion .post-body,
      .use-motion .collection-header {
        visibility: visible;
      }

      .use-motion .header,
      .use-motion .site-brand-container .toggle,
      .use-motion .footer {
        opacity: initial;
      }

      .use-motion .site-title,
      .use-motion .site-subtitle,
      .use-motion .custom-logo-image {
        opacity: initial;
        top: initial;
      }

      .use-motion .logo-line {
        transform: scaleX(1);
      }

      .search-pop-overlay,
      .sidebar-nav {
        display: none;
      }

      .sidebar-panel {
        display: block;
      }
    </style>
  </noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner">
        <div class="site-brand-container">
          <div class="site-nav-toggle">
            <div class="toggle" aria-label="切换导航栏" role="button">
              <span class="toggle-line"></span>
              <span class="toggle-line"></span>
              <span class="toggle-line"></span>
            </div>
          </div>

          <div class="site-meta">

            <a href="/" class="brand" rel="start">
              <i class="logo-line"></i>
              <h1 class="site-title">HolidayPenguin</h1>
              <i class="logo-line"></i>
            </a>
          </div>

          <div class="site-nav-right">
            <div class="toggle popup-trigger">
              <i class="fa fa-search fa-fw fa-lg"></i>
            </div>
          </div>
        </div>



        <nav class="site-nav">
          <ul class="main-menu menu">
            <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
            <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
            <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
            <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
            <li class="menu-item menu-item-search">
              <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
              </a>
            </li>
          </ul>
        </nav>



        <div class="search-pop-overlay">
          <div class="popup search-popup">
            <div class="search-header">
              <span class="search-icon">
                <i class="fa fa-search"></i>
              </span>
              <div class="search-input-container">
                <input autocomplete="off" autocapitalize="off" maxlength="80" placeholder="搜索..." spellcheck="false" type="search" class="search-input">
              </div>
              <span class="popup-btn-close" role="button">
                <i class="fa fa-times-circle"></i>
              </span>
            </div>
            <div class="search-result-container no-result">
              <div class="search-result-icon">
                <i class="fa fa-spinner fa-pulse fa-5x"></i>
              </div>
            </div>

          </div>
        </div>

      </div>


      <div class="toggle sidebar-toggle" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
      </div>

      <aside class="sidebar">

        <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
          <ul class="sidebar-nav">
            <li class="sidebar-nav-toc">
              文章目录
            </li>
            <li class="sidebar-nav-overview">
              站点概览
            </li>
          </ul>

          <div class="sidebar-panel-container">
            <!--noindex-->
            <div class="post-toc-wrap sidebar-panel">
              <div class="post-toc animated">
                <ol class="nav">
                  <li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%8D%E5%AF%B9%E7%AD%89%E7%8E%AF%E5%A2%83%E7%9A%84%E8%81%94%E8%B0%83%E8%BF%87%E7%A8%8B"><span class="nav-number">1.</span> <span class="nav-text">不对等环境的联调过程</span></a>
                    <ol class="nav-child">
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%BC%95%E5%AD%90"><span class="nav-number">1.1.</span> <span class="nav-text">引子</span></a></li>
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF%E9%85%8D%E7%BD%AE%E4%BF%AE%E6%94%B9"><span class="nav-number">1.2.</span> <span class="nav-text">服务器端配置修改</span></a></li>
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%9C%AC%E6%9C%BA%E4%BF%AE%E6%94%B9"><span class="nav-number">1.3.</span> <span class="nav-text">本机修改</span></a></li>
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%94%AF%E4%BB%98%E5%AE%9D%E7%9A%84%E6%94%AF%E4%BB%98"><span class="nav-number">1.4.</span> <span class="nav-text">支付宝的支付</span></a></li>
                    </ol>
                  </li>
                  <li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%8D%E5%AF%B9%E7%AD%89%E7%8E%AF%E5%A2%83%E8%81%94%E8%B0%83%E6%80%BB%E7%BB%93"><span class="nav-number">2.</span> <span class="nav-text">不对等环境联调总结</span></a></li>
                  <li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8%E5%B7%A5%E5%85%B7%E7%AE%A1%E7%90%86host"><span class="nav-number">3.</span> <span class="nav-text">使用工具管理host</span></a>
                    <ol class="nav-child">
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%8A%9F%E8%83%BD%E7%89%B9%E6%80%A7"><span class="nav-number">3.1.</span> <span class="nav-text">功能特性</span></a></li>
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%B7%A5%E5%85%B7%E7%AE%A1%E7%90%86host%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9"><span class="nav-number">3.2.</span> <span class="nav-text">工具管理host注意事项</span></a></li>
                    </ol>
                  </li>
                  <li class="nav-item nav-level-1"><a class="nav-link" href="#%E8%B0%83%E8%AF%95%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%9A%84%E5%B7%A5%E5%85%B7"><span class="nav-number">4.</span> <span class="nav-text">调试中使用的工具</span></a>
                    <ol class="nav-child">
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%A3%E7%90%86%E5%B7%A5%E5%85%B7"><span class="nav-number">4.1.</span> <span class="nav-text">代理工具</span></a></li>
                      <li class="nav-item nav-level-2"><a class="nav-link" href="#Android-%E8%B0%83%E8%AF%95%E5%B7%A5%E5%85%B7"><span class="nav-number">4.2.</span> <span class="nav-text">Android 调试工具</span></a></li>
                    </ol>
                  </li>
                </ol>
              </div>
            </div>
            <!--/noindex-->

            <div class="site-overview-wrap sidebar-panel">
              <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
                <p class="site-author-name" itemprop="name">holidaypenguin</p>
                <div class="site-description" itemprop="description"></div>
              </div>
              <div class="site-state-wrap site-overview-item animated">
                <nav class="site-state">
                  <div class="site-state-item site-state-posts">
                    <a href="/archives/">

                      <span class="site-state-item-count">138</span>
                      <span class="site-state-item-name">日志</span>
                    </a>
                  </div>
                  <div class="site-state-item site-state-categories">
                    <a href="/categories/">

                      <span class="site-state-item-count">26</span>
                      <span class="site-state-item-name">分类</span></a>
                  </div>
                  <div class="site-state-item site-state-tags">
                    <a href="/tags/">

                      <span class="site-state-item-count">234</span>
                      <span class="site-state-item-name">标签</span></a>
                  </div>
                </nav>
              </div>
              <div class="links-of-author site-overview-item animated">
                <span class="links-of-author-item">
                  <a href="https://github.com/holidaypenguin" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;holidaypenguin" rel="noopener" target="_blank"><i class="github fa-fw"></i>GitHub</a>
                </span>
                <span class="links-of-author-item">
                  <a href="mailto:songshipeng2016@gmail.com" title="E-Mail → mailto:songshipeng2016@gmail.com" rel="noopener" target="_blank"><i class="envelope fa-fw"></i>E-Mail</a>
                </span>
              </div>



            </div>
          </div>
        </div>
      </aside>
      <div class="sidebar-dimmer"></div>


    </header>


    <div class="back-to-top" role="button">
      <i class="fa fa-arrow-up"></i>
      <span>0%</span>
    </div>

    <noscript>
      <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
    </noscript>


    <div class="main-inner post posts-expand">





      <div class="post-block">



        <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
          <link itemprop="mainEntityOfPage" href="https://holidaypenguin.gitee.io/blob/2018-12-17-the-use-of-host-in-practical-projects/">

          <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
            <meta itemprop="image" content="/images/avatar.gif">
            <meta itemprop="name" content="holidaypenguin">
            <meta itemprop="description" content="">
          </span>

          <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
            <meta itemprop="name" content="HolidayPenguin">
          </span>
          <header class="post-header">
            <h1 class="post-title" itemprop="name headline">
              host 在实际项目中的使用
            </h1>

            <div class="post-meta-container">
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>

                  <time title="创建时间：2018-12-17 15:01:27" itemprop="dateCreated datePublished" datetime="2018-12-17T15:01:27+08:00">2018-12-17</time>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-folder"></i>
                  </span>
                  <span class="post-meta-item-text">分类于</span>
                  <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                    <a href="/categories/Host/" itemprop="url" rel="index"><span itemprop="name">Host</span></a>
                  </span>
                </span>


                <span id="/blob/2018-12-17-the-use-of-host-in-practical-projects/" class="post-meta-item leancloud_visitors" data-flag-title="host 在实际项目中的使用" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
              </div>

              <div class="post-description">
                <!-- more -->
              </div>
            </div>
          </header>




          <div class="post-body" itemprop="articleBody">
            <blockquote>
              <p>今天体会到了实践出真知，回过头来看发现已经有了成熟的案例，大家都在使用，在这里记录我自己下体验。</p>
            </blockquote>
            <h1 id="不对等环境的联调过程"><a href="#不对等环境的联调过程" class="headerlink" title="不对等环境的联调过程"></a>不对等环境的联调过程</h1>
            <h2 id="引子"><a href="#引子" class="headerlink" title="引子"></a>引子</h2>
            <p>对接外部系统微信、支付宝的支付通道，因为对方只能在线上环境测试且对方不将我方测试域名加入对方线上白名单中，导致我方在测试环境中使用对方线上数据环境测试不能完美进行下去。</p>
            <p>因为微信支付宝的实现方式不同，故先解决微信支付的问题。</p>
            <h2 id="服务器端配置修改"><a href="#服务器端配置修改" class="headerlink" title="服务器端配置修改"></a>服务器端配置修改</h2>
            <p>首先考虑对方只能使用线上域名，故寻求运维，只要进入我方网络该域名转发到测试环境，失败。</p>
            <p>因为项目使用的smarty3，且转发的域名使用的配置，在开始修改之前修改代码配置为线上域名。</p>
            <p>然后整合我手上掌握的资源，前端服务器（代码+nginx），因完全使用线上域名，故肯定不能请求到测试服务器，失败。</p>
            <p>只能考虑使用本机配置host，遂行之，然败矣；验证使用ip直接访问，仍失败，然后在nginx <code>server name</code> 中添加 该ip，访问成功。喜。</p>
            <p>接下来使用域名访问还是失败，继续在nginx <code>server name</code> 中添加该域名，访问成功；到此服务器端的配置完成</p>
            <h2 id="本机修改"><a href="#本机修改" class="headerlink" title="本机修改"></a>本机修改</h2>
            <p>本机除了上面配置的host，还需要如下调整。</p>
            <p>因为最终还是需要在手机上配置，所以要想办法把手机的请求转发给服务器，只能使用电脑拦截然后转发到服务器。</p>
            <p>拦截使用fiddler代理，拦截手机上的请求。且测试环境smarty日志有输出，成功。</p>
            <p>到此使用的工具都调试好了。<br>但是微信还是不能访问成功，因为手机挂代理的时候微信网页授权不能访问（具体原因不明）；<br>这时只能通过先去掉代理，然后手动取得想要的数据，拼接一个线上域名的url；在手机挂代理的情况下访问该地址，有效。</p>
            <p>后面就是微信支付成功了。</p>
            <blockquote>
              <p>但是原本功能完好的微信初始化功能、微信扫二维码加备注功能，都因为不能正确执行到wx.ready方法导致页面不能正确显示，故把对应代码注销掉才可以执行。<br>回归测试使用恢复的代码分支原有功能又没有问题，故归结为代理导致的问题。</p>
            </blockquote>
            <h2 id="支付宝的支付"><a href="#支付宝的支付" class="headerlink" title="支付宝的支付"></a>支付宝的支付</h2>
            <p>因为有了微信的案例，所以支付宝使用同样的方法进行测试。</p>
            <p>百般使用后发现，支付宝里面打开的页面根本不被拦截到，使用了iphone和android都不会被拦截到；</p>
            <p>怀疑是自己电脑问题，又换了一台电脑使用fiddler拦截，还是不可以；</p>
            <p>咨询了在阿里的同学，也是啥都不知道；建议我配置手机host，找了一块android设备，修改之后不生效，放弃；</p>
            <p>最终还是使用查找参数，手动拼接url的方式，而且是测试环境地址，就不需要挂代理。</p>
            <p>一直想让程序自动跑不需要人工干预的方式，由于缺少相关经验，浪费不少时间。</p>
            <h1 id="不对等环境联调总结"><a href="#不对等环境联调总结" class="headerlink" title="不对等环境联调总结"></a>不对等环境联调总结</h1>
            <p>因为开发环境的需要，需要对本机进行管理，如果是手机联调还需要配置代理。。。。</p>
            <ol>
              <li>如果测试环境有nginx且有<code>server name</code>，需要在此将生产域名添加进来</li>
              <li>修改代码中授权回调地址为生产地址</li>
              <li>修改本机host，添加线上域名到测试环境ip的host转发</li>
              <li>配置fiddler拦截器</li>
              <li>修改手机代理地址</li>
              <li>如果出现像微信网页授权在手机配置代理后不能访问的情况，需要手动拼接后续url。</li>
              <li>记得要还原手机代理、本机host、修改的代码、nginx配置。</li>
            </ol>
            <h1 id="使用工具管理host"><a href="#使用工具管理host" class="headerlink" title="使用工具管理host"></a>使用工具管理host</h1>
            <p>推荐使用 <a target="_blank" rel="noopener" href="https://github.com/oldj/SwitchHosts/blob/master/README_cn.md">SwitchHosts</a> 管理工具</p>
            <p>这是一个用于快速切换 hosts 文件的小程序，基于 Electron 开发，同时使用了 React、Ant Design 以及 CodeMirror 等框架/库。</p>
            <h2 id="功能特性"><a href="#功能特性" class="headerlink" title="功能特性"></a>功能特性</h2>
            <ul>
              <li>快速切换 hosts</li>
              <li>hosts 文件语法高亮</li>
              <li>在线 hosts 方案：适用于多人协作，将host文件放置在网络上供他人使用</li>
              <li>系统托盘图标快速切换</li>
              <li>macOS: 支持 Alfred workflow 快速切换</li>
            </ul>
            <h2 id="工具管理host注意事项"><a href="#工具管理host注意事项" class="headerlink" title="工具管理host注意事项"></a>工具管理host注意事项</h2>
            <p>1、运行时要以管理员方式运行，不然会提示无修改权限。在SwitchHosts.exe右键—以管理员身份运行<br>2、如果是绿色单文件版，最好是放在一个文件夹里面再运行，因为会exe所在的目录下生成配置文件和其他文件夹。<br>3、如果双击运行后不能显示SwitchHost界面，但是任务管理器里面能看到SwitchHost的进程，一般是由于hosts文件字符集不统一，导致hosts文件出现乱码，不能被SwitchHost打开，这时候只要删除C:\windows\system32\drivers\etc\hosts 即可。<br>4、如果使用了代理，修改 Hosts 也不会生效。因为浏览器会优先考虑代理工具的代理，建议调试的时候先关闭代理。<br>5、修改了hosts不生效，一般需要重启浏览器，如果是google浏览器可以不用重启，可以借助chrome://net-internals/#dns chrome://net-internals/#sockets 清掉keep-alive 和清浏览器 DNS 缓存。</p>
            <h1 id="调试中使用的工具"><a href="#调试中使用的工具" class="headerlink" title="调试中使用的工具"></a>调试中使用的工具</h1>
            <h2 id="代理工具"><a href="#代理工具" class="headerlink" title="代理工具"></a>代理工具</h2>
            <p>Fiddler4 以及 Charles，其中Fiddler4 可以安装在 Windows上，Charles安装在Mac上。</p>
            <h2 id="Android-调试工具"><a href="#Android-调试工具" class="headerlink" title="Android 调试工具"></a>Android 调试工具</h2>
            <p>Android 使用adb远程控制，但是需要root权限</p>

          </div>





          <footer class="post-footer">
            <div class="post-tags">
              <a href="/tags/Host/" rel="tag"># Host</a>
              <a href="/tags/Hosts/" rel="tag"># Hosts</a>
              <a href="/tags/%E4%BB%A3%E7%90%86/" rel="tag"># 代理</a>
              <a href="/tags/%E8%BD%AC%E5%8F%91/" rel="tag"># 转发</a>
              <a href="/tags/SwitchHosts/" rel="tag"># SwitchHosts</a>
              <a href="/tags/%E7%A7%BB%E5%8A%A8%E7%AB%AF/" rel="tag"># 移动端</a>
            </div>



            <div class="post-nav">
              <div class="post-nav-item">
                <a href="/blob/2018-12-17-modification-and-refresh-of-host-file/" rel="prev" title="host 文件修改与刷新">
                  <i class="fa fa-chevron-left"></i> host 文件修改与刷新
                </a>
              </div>
              <div class="post-nav-item">
                <a href="/blob/2018-12-20-lost-focus-after-button-click/" rel="next" title="button 点击后失去获得的焦点">
                  button 点击后失去获得的焦点 <i class="fa fa-chevron-right"></i>
                </a>
              </div>
            </div>
          </footer>
        </article>
      </div>







      <script>
        window.addEventListener('tabs:register', () => {
          let {
            activeClass
          } = CONFIG.comments;
          if (CONFIG.comments.storage) {
            activeClass = localStorage.getItem('comments_active') || activeClass;
          }
          if (activeClass) {
            const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
            if (activeTab) {
              activeTab.click();
            }
          }
        });
        if (CONFIG.comments.storage) {
          window.addEventListener('tabs:click', event => {
            if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
            const commentClass = event.target.classList[1];
            localStorage.setItem('comments_active', commentClass);
          });
        }
      </script>
    </div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


      <div class="copyright">
        &copy;
        <span itemprop="copyrightYear">2021</span>
        <span class="with-love">
          <i class="fa fa-heart"></i>
        </span>
        <span class="author" itemprop="copyrightHolder">holidaypenguin</span>
      </div>
      <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
      </div>

    </div>
  </footer>


  <script size="300" alpha="0.1" zIndex="-1" src="https://cdn.jsdelivr.net/npm/ribbon.js@1.0.2/dist/ribbon.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
  <script src="/js/love.js"></script>

  <script src="/js/development.js"></script>
  <script src="/js/utils.js"></script>
  <script src="/js/motion.js"></script>
  <script src="/js/schemes/muse.js"></script>
  <script src="/js/next-boot.js"></script>


  <script src="/js/local-search.js"></script>









  <script>
    (function() {
      function leancloudSelector(url) {
        url = encodeURI(url);
        return document.getElementById(url).querySelector('.leancloud-visitors-count');
      }

      function addCount(Counter) {
        const visitors = document.querySelector('.leancloud_visitors');
        const url = decodeURI(visitors.id);
        const title = visitors.dataset.flagTitle;

        Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({
            url
          })))
          .then(response => response.json())
          .then(({
            results
          }) => {
            if (results.length > 0) {
              const counter = results[0];
              leancloudSelector(url).innerText = counter.time + 1;
              Counter('put', '/classes/Counter/' + counter.objectId, {
                  time: {
                    '__op': 'Increment',
                    'amount': 1
                  }
                })
                .catch(error => {
                  console.error('Failed to save visitor count', error);
                });
            } else {
              Counter('post', '/classes/Counter', {
                  title,
                  url,
                  time: 1
                })
                .then(response => response.json())
                .then(() => {
                  leancloudSelector(url).innerText = 1;
                })
                .catch(error => {
                  console.error('Failed to create', error);
                });
            }
          })
          .catch(error => {
            console.error('LeanCloud Counter Error', error);
          });
      }

      function showTime(Counter) {
        const visitors = document.querySelectorAll('.leancloud_visitors');
        const entries = [...visitors].map(element => {
          return decodeURI(element.id);
        });

        Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({
            url: {
              '$in': entries
            }
          })))
          .then(response => response.json())
          .then(({
            results
          }) => {
            for (let url of entries) {
              const target = results.find(item => item.url === url);
              leancloudSelector(url).innerText = target ? target.time : 0;
            }
          })
          .catch(error => {
            console.error('LeanCloud Counter Error', error);
          });
      }

      const {
        app_id,
        app_key,
        server_url
      } = {
        "enable": true,
        "app_id": "povuqNsSqFodlakVIwtEX5kb-gzGzoHsz",
        "app_key": "zXD40RDtDB3DMtpC89k0AK7g",
        "server_url": null,
        "security": false
      };

      function fetchData(api_server) {
        const Counter = (method, url, data) => {
          return fetch(`${api_server}/1.1${url}`, {
            method,
            headers: {
              'X-LC-Id': app_id,
              'X-LC-Key': app_key,
              'Content-Type': 'application/json',
            },
            body: JSON.stringify(data)
          });
        };
        if (CONFIG.page.isPost) {
          if (CONFIG.hostname !== location.hostname) return;
          addCount(Counter);
        } else if (document.querySelectorAll('.post-title-link').length >= 1) {
          showTime(Counter);
        }
      }

      const api_server = app_id.slice(-9) === '-MdYXbMMI' ? `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com` : server_url;

      if (api_server) {
        fetchData(api_server);
      } else {
        fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id)
          .then(response => response.json())
          .then(({
            api_server
          }) => {
            fetchData('https://' + api_server);
          });
      }
    })();
  </script>



<script>
            window.imageLazyLoadSetting = {
                isSPA: false,
                preloadRatio: 1,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(n){n.imageLazyLoadSetting.processImages=o;var e=n.imageLazyLoadSetting.isSPA,i=n.imageLazyLoadSetting.preloadRatio||1,r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]"));function o(){e&&(r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")));for(var t,a=0;a<r.length;a++)0<=(t=(t=r[a]).getBoundingClientRect()).bottom&&0<=t.left&&t.top<=(n.innerHeight*i||document.documentElement.clientHeight*i)&&function(){var t,e,n,i,o=r[a];t=o,e=function(){r=r.filter(function(t){return o!==t})},n=new Image,i=t.getAttribute("data-original"),n.onload=function(){t.src=i,e&&e()},t.src!==i&&(n.src=i)}()}o(),n.addEventListener("scroll",function(){var t,e;t=o,e=n,clearTimeout(t.tId),t.tId=setTimeout(function(){t.call(e)},500)})}(this);</script></body>

</html>